# A Google Command Line Program
# Cache request class and related methods
# Copyright (C) 2005 by Deryck Hodge
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# TODO: Would be nice to offer a few methods for parsing
# the page that is returned.

from libgcli.search import Service

class GoogleCache(Service):
    """GoogleCache takes Params().search_params() as an argument.
       The url of the page to retrive must be passed as the query.

       Example:
            p = Params()
            p.query = URL
            page = GoogleCache(p).get_page()
    """

    def __init__(self, params):
        Service.__init__(self, params)
        self.params = params
        self.page = self.connection.doGetCachedPage(params.key, params.query)

    def get_page(self):
        return self.page

